<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>财务信息</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
    <!--<link href="__PUBLIC__/admin/js/layui/css/layui.css" rel="stylesheet">-->

</head>
<include file="Admin@Index:cache" />
<body class="gray-bg contacts">
<style>
    .table-hover>tbody>tr>td{
        height:4rem;
    }
</style>
<div class="wrapper wrapper-content animated fadeInRight" oncopy="copyval()">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>财务信息</h2>
                    <div class="col-sm-12" style="margin-bottom: 1rem">
                        <form role="form" action="__SELF__" method="get">
                            <div class="form-group">
                                <input type="text" id="content" placeholder="" name="content" class="form-control">
                            </div>
                            <div>
                                    <input style="height: 2.5rem;" autocomplete="off" class="laydate-icon" placeholder="起始时间" id="start" name="start">       <input style="height: 2.5rem;" class="laydate-icon" autocomplete="off" placeholder="截止时间" id="end" name="end">
                                <select id="time_type" name='time_type' class="form-control m-b" style="margin-bottom: 0;padding-top: 3px;display: inline;width: 10%;" >
                                    <option value="should_time">选择时间</option>
                                    <option value="ctime" >借款时间</option>
                                    <option value="repayment_time" >还款时间</option>
                                </select>

                                <select name="status" id="status" class="form-control m-b"  style="margin-bottom: 0;padding-top: 3px;display: inline;width: 10%;" >
                                    <!--订单状态1未确认,2已确认,3已逾期,4续期,5已坏账,6已撕毁,7被拒绝9已打款-->
                                    <option value="">状态</option>
                                    <option value="0" <if condition="$_GET['status'] eq 0">selected</if>>待支付</option>
                                    <option value="1" <if condition="$_GET['status'] eq 1">selected</if>>未确认</option>
                                    <option value="2" <if condition="$_GET['status'] eq 2">selected</if>>已确认</option>
                                    <option value="3" <if condition="$_GET['status'] eq 3">selected</if>>已逾期</option>
                                    <option value="4" <if condition="$_GET['status'] eq 4">selected</if>>已续借</option>
                                    <option value="5" <if condition="$_GET['status'] eq 5">selected</if>>已坏账</option>
                                    <option value="6" <if condition="$_GET['status'] eq 6">selected</if>>已撕毁</option>
                                    <option value="7" <if condition="$_GET['status'] eq 7">selected</if>>已拒绝</option>
                                    <option value="9" <if condition="$_GET['status'] eq 9">selected</if>>已打款</option>
                                </select>

                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit" id="search"><strong>搜索</strong>
                                </button>

                            </div>
                        </form>
                    </div>
                    <br>
                    <table class="table table-striped table-hover">
                        <tbody>
                        <tr>
                            <th style="width: 12%;">订单号</th>
                            <th>渠道来源</th>
                            <th>借款时间</th>
                            <th>借款人姓名</th>
                            <th>借款人手机号</th>
                            <th>账单金额</th>
                            <th>实际还款时间</th>
                            <th>实际到账</th>
                            <th>支付方式</th>
                            <th>状态</th>
                            <th>凭证</th>
                            <th>展期信息</th>
                        </tr>
                        <foreach name="list" item="list">
                            <tr>
                                <td><{$list.numbering}></td>
                                <td><{$list.channel}></td>
                                <td><{$list.loan_time}></td>
                                <td><{$list.borrower}></td>
                                <td><{$list.mobile}></td>
                                <td><{$list.money}></td>
                                <td><{$list.tear_time}></td>
                                <td><{$list.actual_money}></td>
                                <td>
                                    <switch name="list.pay_type">
                                        <case value="1">银行卡</case>
                                        <case value="2">支付宝</case>
                                        <case value="3">微信</case>
                                        <case value="4">其他</case>
                                    </switch>
                                </td>
                                <td>
                                    <switch name="list.status">
                                        <case value="0">待支付</case>
                                        <case value="1">未确认</case>
                                        <case value="2">已确认</case>
                                        <case value="3">已逾期</case>
                                        <case value="4">已续期</case>
                                        <case value="5">已坏账</case>
                                        <case value="6">已撕毁</case>
                                        <case value="7">已被拒</case>
                                        <case value="9">已打款</case>
                                    </switch>
                                </td>
                                <td>
                                    <if condition="$list['money_certificate'] neq ''">
                                    <a class="btn btn-info btn-rounded " href="javascript:void(0);" onclick="showImg('<{$list.money_certificate}>')">查看</a>
                                    </if>
                                </td>
                                <td> <a class="btn btn-info btn-rounded " href="javascript:void(0);" onclick="get_period('<{$list.numbering}>','<{$list.repayment_time}>','<{$list.money}>')" >详情</a></td>
                                <!--订单状态1未确认,2已确认,3已逾期,4续期,5已坏账,6已撕毁,7被拒绝9已打款-->
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                    <ul class="pagination">
                        <{$fpage}>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/admin/js/layer/layer.js"></script>
<script src="__PUBLIC__/admin/js/layui/layui.js"></script>
<script src="__PUBLIC__/admin/js/layui/lay/modules/laydate.js"></script>
<!--<script src="__PUBLIC__/admin/js/layui/lay/dest/layui.all.js"></script>-->
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/admin/js/plugins/fancybox/jquery.fancybox.js"></script>
<script type="text/javascript" src="__PUBLIC__/admin/js/ajaxfileupload.js"></script>

<script>
    $(document).ready(function () {
        $('.contact-box').each(function () {
            animationHover(this, 'pulse');
        });
    });


    $(document).ready(function () {
        $('.fancybox').fancybox({
            openEffect: 'none',
            closeEffect: 'none'
        });
    });

    layui.use('laydate', function(){
        var laydate = layui.laydate;
        var start = {
            choose:function(dates){
                end.min = dates; //开始日选好后，重置结束日的最小日期
                end.start = dates; //将结束日的初始值设定为开始日
            }
        };
        var end = {
            choose:function(dates){
                start.max = dates; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('start').onclick = function(){
            start.elem = this;
            laydate(start);
        }
        document.getElementById('end').onclick = function(){
            end.elem = this;
            laydate(end);
        }
    });


    function showImg(url) {
        var img = "<img style='width:500px;height: 500px' src='" + url + "' id='img' />";
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: ['500px','500px'],
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content: img
        });
    }

        //获取续期信息
    function get_period(numbering,repayment_times,money){
        $.post('__MODULE__/Mypublic/get_certificate_period',{numbering:numbering},function(data){
            console.log(data);
            if(data.code=='1001'){
                var html='';
                html+='<div class="modal-body" id="lists" style="height:100%">';
                html+='<form class="form-horizontal">';
                html+='<div class="form-group">';
                html+='<div class="col-sm-12">';
                html+='<div style="padding: 10px 0;display:flex" id="period"><span style="width: 15%">展期本金</span><span style="width: 20%">原还款日</span><span style="width: 20%">现还款日</span><span style="width: 10%">利息</span><span style="width: 10%">年利率</span><span style="width: 15%">展期天数</span><span style="width: 10%">状态</span></div>';
                if(data.result!=''){
//                    var reason=eval('('+data.result+')');
                    $(data.result).each(function(k,v){
                        html+='<div style="padding: 10px 0;display:flex"><span style="width: 15%">'+ v.money+'</span><span style="width: 20%">'+ v.repayment_time+'</span><span style="width: 20%">'+ v.period_time+'</span><span style="width: 10%">'+ v.interest+'</span><span style="width: 10%">'+ v.interest_rate+'</span><span style="width: 15%">'+ v.period_days+'</span><span style="width: 10%">'+ v.status+'</span></div>';
                    });
                }else{
                    html+='<div style="padding: 10px 0;font-size:2rem">暂无记录</div>';
                }
                html+='</div>';
                html+='</div>';
                html+='<p id="pp"></p>';
                html+='</form>';
                html+='<div class="modal-footer" style="padding-top:1rem;position:relative;border:none">';
                html+='<a href="javascript:void(0);" onclick="layer.closeAll()" type="button" class="btn btn-default" >关闭</a>';

                html+='</div>';
                html+='</div>';
                layer.open({
                    type: 1, //Page层类型
                    area: ['600px','400px'],
                    title: '续期信息',
                    shade: 0.6, //遮罩透明度
                    maxmin: true, //允许全屏最小化
                    anim: 1, //0-6的动画形式，-1不开启
                    content: html
                });
            }else{
                if(data.status=='0'){
                    layer.msg(data.info,{time:2000,icon:5});
                }else{
                    layer.msg(data.result,{time:2000,icon:5});
                }
            }
        });
    }

    function copyval() {
//        event.returnValue = false;
        var content = window.getSelection().toString();
        $.post('__MODULE__/Mypublic/copy_all', {content:content}, function (data) {
            if (data.code == '1001') {
            } else {
                console.log(data);
            }
        });
//        console.log(content)
    }
</script>


</body>

</html>
